
import {toLine} from '~/page/FineBi/utils/convert';

export const searchForm = [
    {
        type: 'select',
        key: 'department',
        label: '学部',
        optionsConfig: {
            options: [],
            pager: {}
        },
        props: {
            mode: 'multiple'
        }
    },
    {
        type: 'select',
        key: 'grade',
        label: '年级',
        optionsConfig: {
            options: [],
            pager: {}
        },
        props: {
            mode: 'multiple'
        }
    },
    {
        type: 'select',
        key: 'subjectId',
        label: '学科',
        optionsConfig: {
            options: [],
            pager: {}
        },
        props: {
            mode: 'multiple'
        }
    },
    {
        type: 'select',
        key: 'groupStatus',
        label: '新老学员',
        optionsConfig: {
            options: [],
            pager: {}
        },
        props: {
            mode: 'multiple'
        }
    }
];

export const initialValues = {
    department: ['全部'],
    subjectId: ['全部'],
    grade: ['全部'],
    groupStatus: ['全部']
};

export const getDefaultDimension = (dId, initialValues) => {
    const dimension = [];
    for (const i in initialValues) {
        dimension.push({
            dimensionId: `${dId}_${toLine(i)}`,
            dimensionName: toLine(i),
            value: initialValues[i]
        });
    }
    return dimension;
};
